<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
 * Created by PhpStorm.
 * User: nhson219
 * Date: 8/15/14
 * Time: 11:09 AM
 */
    function showMessage($type = '',$msg = ''){

        $CI = &get_instance();
        $data['msg'] = $msg;
        $data['type'] = $type;
        $CI->load->view('common/alert',$data);
    }

    function showMessage2($data){
        if($data['type'] == 'error'){
            $result = '<div class="alert alert-danger">
                    <button data-dismiss="alert" class="close"></button>
                    <i class="fa fa-times-circle"></i>
                    <strong></strong>
                    <ul>'.$data["message"].'</ul></div>';
        }elseif($data['type'] == 'success'){
            $result = '<div class="alert alert-success">
                    <button data-dismiss="alert" class="close"></button>
                    <i class="fa fa-times-circle"></i>
                    <strong></strong>
                    <ul>'.$data["message"].'</ul></div>';
        }elseif($data['type'] == 'warning'){
            $result = '<div class="alert alert-warning">
                    <button data-dismiss="alert" class="close"></button>
                    <i class="fa fa-times-circle"></i>
                    <strong></strong>
                    <ul>'.$data["message"].'</ul></div>';
        }

        echo $result;
    }

    function setMessage($type,$message)
    {
        $data['message'] = $message;
        $data['type'] = $type;

        return $data;
    }
?>